package demo.java.lang.management.vo;

import java.util.List;

/**
 * jvm启动后，一直会变化的监控项
 * @author buffoon
 * @date 16/1/15
 */
public class DynamicJvmModel {

    private String appName;

    private String hostname;

    private JVMClassLoading classLoading;

    private List<GarbageCollectorInfo> garbageCollectorInfos;

    private List<MemoryPool> memoryPools;

    private JVMProcessStat processStat;

    private List<JVMThreadInfo> threadInfos;

    private long timestamp;

    public DynamicJvmModel(String appName, String hostname, JavaProcess javaProcess){
        this.appName = appName;
        this.hostname = hostname;
        this.classLoading = javaProcess.getClassLoading();
        this.garbageCollectorInfos = javaProcess.getGarbageCollectorInfos();
        this.memoryPools = javaProcess.getMemoryPools();
        this.processStat = javaProcess.getProcessStat();
        this.threadInfos = javaProcess.getTheadInfos();
        this.timestamp = System.currentTimeMillis() - System.currentTimeMillis()%1000;
    }

    public String getHostname() {
        return hostname;
    }

    public void setHostname(String hostname) {
        this.hostname = hostname;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public String getAppName() {
        return appName;
    }

    public void setAppName(String appName) {
        this.appName = appName;
    }

    public JVMClassLoading getClassLoading() {
        return classLoading;
    }

    public void setClassLoading(JVMClassLoading classLoading) {
        this.classLoading = classLoading;
    }

    public List<GarbageCollectorInfo> getGarbageCollectorInfos() {
        return garbageCollectorInfos;
    }

    public void setGarbageCollectorInfos(List<GarbageCollectorInfo> garbageCollectorInfos) {
        this.garbageCollectorInfos = garbageCollectorInfos;
    }

    public List<MemoryPool> getMemoryPools() {
        return memoryPools;
    }

    public void setMemoryPools(List<MemoryPool> memoryPools) {
        this.memoryPools = memoryPools;
    }

    public JVMProcessStat getProcessStat() {
        return processStat;
    }

    public void setProcessStat(JVMProcessStat processStat) {
        this.processStat = processStat;
    }

    public List<JVMThreadInfo> getThreadInfos() {
        return threadInfos;
    }

    public void setThreadInfos(List<JVMThreadInfo> threadInfos) {
        this.threadInfos = threadInfos;
    }
}
